float4    g_mtrlDiffuse : DIFFUSE;
float     g_fAlpha      : FLOAT0;
texture   g_Tex0        : TEXTURE0;
bool      g_bTexture    : BOOL0;

sampler gTexS = sampler_state
{
	Texture = <g_Tex0>;
	MinFilter = LINEAR;
	MagFilter = LINEAR;
};


struct OUTVS{
	float4 vPosition : POSITION0;
	float2 vTexCoord : TEXCOORD0;
};

OUTVS uiVS(float4 vInPosition : POSITION0, float2 vTex:TEXCOORD0){
	OUTVS outVS = (OUTVS)0;
	outVS.vTexCoord = vTex;
	return outVS;
}

float4 uiPS(float2 vTexCoord : TEXCOORD0):COLOR0{
	float3 TexColor = tex2D(gTexS,vTexCoord);
	float3 PlainColor = g_mtrlDiffuse.xyz;
	float3 Color = g_bTexture?TexColor:PlainColor;
	return float4(Color,g_fAlpha);
}

technique uiTech{

	pass P0{
		vertexShader = compile vs_2_0 uiVS();
		pixelShader  = compile ps_2_0 uiPS();
		ZENABLE = false;
		AlphaBlendEnable = true;
		SrcBlend = One;
		DestBlend = InvSrcAlpha;
	}
}
